﻿
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[sproc_UpdatePositionCaste]') AND type in (N'P', N'PC'))
    DROP PROCEDURE [dbo].[sproc_UpdatePositionCaste];
GO
CREATE PROCEDURE [dbo].[sproc_UpdatePositionCaste]
    @PositionID int,
    @NewCaste   int
AS

UPDATE 
    uds_staff
    SET caste = @NewCaste
    WHERE staff_id IN (
                SELECT 
                    staff_id 
                    FROM 
                        uds_staff_in_position 
                    WHERE     position_id = @positionid
              )